<html>
    <head>
        <script>
            function aa(id){
                if (id == 1){
                var a = document.getElementById('txt1').value
                document.getElementById('txt2').value = a
                document.getElementById('lbl1').value = a
            }
            else{
                var a = document.getElementById('txt2').value
                document.getElementById('txt1').value = a
                document.getElementById('lbl1').value = a
            }
            }
            

        </script>
    </head>
    <body>

        <input type="text" id="txt1" value="Hello World!aaaaaaaaa" oninput="aa(1)"><br>
        <input type="text" id="txt2" value="Hello World!aaaaaaaaa"  oninput="aa(2)"><br>
        <input type="text" id="lbl1" value="Hello World!aaaaaaaaa" readonly="true"><br>
        <input type="button" value="提交" onclick="aa()"><br>
    </body>
    
</html>